package com.jd.ty.pojo;

import java.util.Calendar;
import java.util.Comparator;

public class OrderTimeComparetor implements Comparator<CustomerOrder> {

	public int compare(CustomerOrder order1, CustomerOrder order2) {
		if (order1.getDealDate() == null || order2.getDealDate() == null)
			return 0;
		Calendar cal1 = Calendar.getInstance();
		cal1.setTime(order1.getDealDate());

		Calendar cal2 = Calendar.getInstance();
		cal2.setTime(order2.getDealDate());

		int sen = cal1.compareTo(cal2);

		if (sen < 0) {
			return -1;
		}
		if (sen > 0) {
			return 1;
		}
		return 0;
	}

}
